package thread;

/**
 * @Author: zhanghuan
 * @date: 2020/10/2 14:43
 * @description:
 */
public class TestYield implements Runnable {

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + "开始执行");
//        Thread.yield();//礼让
        System.out.println(Thread.currentThread().getName() + "停止执行");
    }

    public static void main(String[] args) {
        TestYield myThread = new TestYield();
        new Thread(myThread, "A").start();
        new Thread(myThread, "B").start();
    }
}
